package com.zmx.patients.adapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.wang.adapters.adapter.BaseAdapterRvList;
import com.wang.adapters.base.BaseViewHolder;
import com.zmx.patients.R;
import com.zmx.patients.pojo.Replay;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ReplayAdapter extends BaseAdapterRvList<ReplayAdapter.ViewHolder, Replay> {


    public ReplayAdapter(Activity activity) {
        super(activity);
    }

    @Override
    protected void onBindVH(ViewHolder holder, int listPosition, Replay replay) {


        Glide.with(mActivity).load(replay.getAvatar()).into(holder.head);
        holder.comtext.setText(replay.getContent());
        holder.name.setText(replay.getName());
        holder.time.setText(replay.getReplytime());

    }

    @NonNull
    @Override
    protected ViewHolder onCreateVH(ViewGroup parent, LayoutInflater inflater) {
        ReplayAdapter.ViewHolder holder = new ReplayAdapter.ViewHolder(inflater.inflate(R.layout.adapter_replay, parent, false));
        return holder;
    }

    static class ViewHolder extends BaseViewHolder {

        @BindView(R.id.head)
        ImageView head;
        @BindView(R.id.name)
        TextView name;
        @BindView(R.id.comtext)
        TextView comtext;
        @BindView(R.id.time)
        TextView time;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

    }


}
